<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    #box {
      width: 200px;
      height: 200px;
      padding: 100px;
      border: 20px solid red;
      background: darkcyan;
      margin: 20px;
    }
  </style>
</head>

<body>
  <ul>
    <li>脉动</li>
    <li>炫迈</li>
    <li>红牛</li>
    <li>可乐</li>
  </ul>
  <div id="box"></div>
  <script src="./jquery-3.4.1.min.js"></script>
  <script>
    // $("#box").css({})
    $("ul li").css({
      width: function (index, oldVal) {
        return (index + 1) * 60 + "px"
      },
      background: function (index, oldVal) {
        return "#" + Math.floor(Math.random() * 0xffffff).toString(16)
      },
      "margin-top": "20px"
    })

    // width() 和heiht()获取和设置元素宽度   不包括padding和border
    $("#box").width(300)
    $("#box").height(300)
    console.log($("#box").width())
    console.log($("#box").height())

    //innerWidth() 和innerHeight()  包括padding 不包括border 
    console.log($("#box").innerWidth())
    console.log($("#box").innerHeight())
    //outerWidth和outerHeight()  包括padding 包括border
    console.log($("#box").outerWidth())
    console.log($("#box").outerHeight())
   //

  </script>
</body>

</html>